#undef NDEBUG
#include "utils/logger.h"
#include "Output.h"
#include "common.h"
#include "SerializableOutput.h"
#include "proto/internal.pb.h"

using namespace std;
using namespace internal;

int main(int argc, char** argv) {
	{
		InputOperation twoIntColumns;
		twoIntColumns.add_type(InputOperation::INT);
		twoIntColumns.add_type(InputOperation::INT);

		// two empty int columns
		Output output1;
		output1.push_back(Output_elem(0, INT));
		output1.push_back(Output_elem(0, INT));

		// two int columns with 2 rows
		Output output2;
		output2.push_back(Output_elem(new int32_t[2], INT));
		output2.push_back(Output_elem(new int32_t[2], INT));
		// row 0
		((int32_t*) output2[0].column)[0] = 0;
		((int32_t*) output2[0].column)[0] = 0;
		// row 1
		((int32_t*) output2[1].column)[0] = 1;
		((int32_t*) output2[1].column)[0] = 1;

		SerializableOutput ser1(twoIntColumns);
		CHECK(ser1.rowsCount() == 0, "");
		ser1.append(output1, 0);
		ser1.append(output1, 0);
		ser1.append(output1, 0);
		CHECK(ser1.rowsCount() == 0, "");
		ser1.append(output2, 2);
		CHECK(ser1.rowsCount() == 2, "");
	}
	return 0;
}
